home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / getmsg.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  75 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: getmsg.c,v 1.4 1996/08/13 13:56:03 digulla Exp $
  4.     $Log: getmsg.c,v $
  5.     Revision 1.4  1996/08/13 13:56:03  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.3  1996/08/01 17:41:12  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang: english
  15. */
  16. #include <exec/execbase.h>
  17. #include <exec/ports.h>
  18. #include <aros/libcall.h>
  19.  
  20. /*****************************************************************************
  21.  
  22.     NAME */
  23.     #include <clib/exec_protos.h>
  24.  
  25.     __AROS_LH1(struct Message *, GetMsg,
  26.  
  27. /*  SYNOPSIS */
  28.     __AROS_LHA(struct MsgPort *, port, A0),
  29.  
  30. /*  LOCATION */
  31.     struct ExecBase *, SysBase, 62, Exec)
  32.  
  33. /*  FUNCTION
  34.     Get a message from a given messageport. This function doesn't wait
  35.     and returns NULL if the messageport is empty. Therefore it's
  36.     generally a good idea to WaitPort() or Wait() on the given port first.
  37.  
  38.     INPUTS
  39.     port - Pointer to messageport
  40.  
  41.     RESULT
  42.     Pointer to message removed from the port.
  43.  
  44.     NOTES
  45.  
  46.     EXAMPLE
  47.  
  48.     BUGS
  49.  
  50.     SEE ALSO
  51.     WaitPort(), PutMsg()
  52.  
  53.     INTERNALS
  54.  
  55.     HISTORY
  56.  
  57. ******************************************************************************/
  58. {
  59.     __AROS_FUNC_INIT
  60.  
  61.     struct Message *msg;
  62.  
  63.     /* Protect the message list. */
  64.     Disable();
  65.  
  66.     /* Get first node. */
  67.     msg=(struct Message *)RemHead(&port->mp_MsgList);
  68.  
  69.     /* All done. */
  70.     Enable();
  71.     return msg;
  72.     __AROS_FUNC_EXIT
  73. }
  74.  
  75.